package ch.zbw.pra.sysventory.ui.gui.panels.overviewandsearchpanel.subpanels.detailPanel;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JLabel;
import javax.swing.JPanel;

import ch.zbw.pra.sysventory.domain.model.Computer;
import ch.zbw.pra.sysventory.ui.gui.panels.overviewandsearchpanel.subpanels.detailPanel.DetailTablePanel.DetailTableEnum;
import ch.zbw.pra.sysventory.ui.gui.utilities.GuiLayout;

public class RightDetailPanel extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6317322242495340185L;
	private Computer computer;

	public RightDetailPanel(Computer computer) {
		this.computer = computer;

		init();
	}

	public void init() {
		this.setVisible(true);

		int x = 0;
		int y = 0;
		GridBagLayout gridBagLayout = GuiLayout.getGridBagLayout(this);

		double tableGrowth = 0.0;
		// double nor = 0.0;
		// double strech = 1.0;
		// gridBagLayout.rowWeights = new double[] { nor, nor, nor, nor, nor,
		// nor, nor, nor, nor, nor, nor, nor, nor, nor, nor, nor, nor, nor, nor,
		// nor, nor, nor, nor, nor, nor, nor, nor, nor, nor, nor, nor, nor,
		// strech };
		GridBagConstraints gridBagConstraints = GuiLayout.getGridBagConstraints();
		gridBagLayout = GuiLayout.getGridBagLayout(this);
		gridBagLayout.columnWeights = new double[] { tableGrowth };
		gridBagLayout.columnWidths = new int[] { 150 };
		// gridBagConstraints.weightx = 0.0;
		Insets forAll = new Insets(1, 5, 0, 5);
		Insets forTitle = new Insets(10, forAll.left, forAll.bottom, forAll.right);
		gridBagConstraints.insets = forAll;
		y++;
		x = 0;

		gridBagConstraints.insets = forTitle;
		GuiLayout.addToLayout(this, gridBagLayout, gridBagConstraints, x++, y, 2, 1, new JLabel(
				"Software-\u00DCbersicht"));
		gridBagConstraints.insets = forAll;
		y++;
		x = 0;
		// Softwares
		GuiLayout.addToLayout(this, gridBagLayout, gridBagConstraints, x++, y, 2, 1, 1, 1,
				new DetailTablePanel(this.computer, DetailTableEnum.SOFTWARE));
		y++;
		x = 0;
		// Nics
		gridBagConstraints.insets = forTitle;
		GuiLayout.addToLayout(this, gridBagLayout, gridBagConstraints, x++, y, 2, 1, new JLabel(
				"Netzwerkkarten-\u00DCbersicht"));
		gridBagConstraints.insets = forAll;
		y++;
		x = 0;
		GuiLayout.addToLayout(this, gridBagLayout, gridBagConstraints, x++, y, 2, 1, 1, 1,
				new DetailTablePanel(this.computer, DetailTableEnum.NIC));

	}

}
